<link rel="stylesheet" href="assets/store/css/goods.css?v=<?= $version ?>">
<style>
    .table_box{
        min-width: 1000px;
    }

    .table-title{
       line-height: 30px;
    }

    .table_box th{
        display: block;
        padding:  3px;
    }
    .table_box .table-title th{
        width: 100%;
        text-align: center;
    }
    .table-fbt{
        width: 100%;
        line-height: 30px;
        text-align: left;
    }
    .table_box td{
        text-align: left;
        padding:0  3px;
        line-height: 40px;
    }
    .table_box tbody{
        display: table;
        width: 100%;
    }

    .table_box input{
        outline: 0;
        border: 0!important;
        padding-top: 0!important;
        padding-bottom: 0!important;
        line-height: 40px!important;
    }
    .table_box .short-input td span{
        float: left;
    }
    .table_box .short-input td input{
        width: 95px !important;
        border: 0 !important;
        float: left;
    }
    .table_box .short-input-radio input{
        width: 20px;
        float: right;
    }
    .table_box .short-input td ,.short-input-radio td{
        width: 16.6667%;
    }
    </style>
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">基本信息</div>
                            </div>
                            <div class="tablebox">
                                <table class="table_box"  border="1" cellspacing="0" cellpadding="0">
                                   <thead>
                                   <tr class="table-title"><th><input type="text" name="fitness[title]" value="" placeholder="eg:运动阶段测试" style="text-align: center"></th></th></tr>
                                   <tr class="table-fbt"><th>一 基本信息：</th></tr>
                                   </thead>
                                    <tbody>
                                    <tr class="short-input">
                                        <td ><span>姓名：</span><input type="text" v-model="user.name"></td>
                                        <td ><span>性别：</span><input type="text" v-model="user.sex"></td>
                                        <td ><span>年龄:</span><input type="text" v-model="user.age"></td>
                                        <td ><span>身高:</span><input type="text" v-model="user.height"><span>cm</span></td>
                                        <td ><span>体重:</span><input type="text" v-model="user.weight"><span>kg</span></td>
                                        <td ></td>
                                    </tr>
                                    <tr class="short-input-radio">
                                        <td ><span>训练目的：</span></td>
                                        <td ><span>增肌</span><input type="radio" value="1" name="md" v-model="purpose"></td>
                                        <td ><span>减脂</span><input type="radio" value="2" name="md" v-model="purpose"></td>
                                        <td ><span>塑性（手臂 臀部）</span><input type="radio" name="md" value="3" v-model="purpose"></td>
                                        <td ><span>格斗技巧</span><input type="radio" value="4" name="md" v-model="purpose"></td>
                                        <td ><span>释放压力</span><input type="radio" value="5" name="md" v-model="purpose"></td>
                                    </tr>
                                    <tr class="short-input">
                                        <td >训练时长</td>
                                        <td colspan="5">
                                            <span>第</span>
                                            <input type="text" v-model="duration.stage">
                                            <span>阶段 </span>
                                            <span style="margin-left: 10px">第</span>
                                            <input type="text" v-model="duration.joint">
                                            <span>节</span>
                                        </td>
                                    </tr>
                                    <tr style="font-weight: bold"><td colspan="6">二 围度测试：</td></tr>
                                    <tr class="short-input">
                                        <td ><span>胸围:</span><input type="text" v-model="girth.chest"><span>cm</span></td>
                                        <td ><span>腰围:</span><input type="text" v-model="girth.waistline"><span>cm</span></td>
                                        <td ><span>臀围:</span><input type="text" v-model="girth.hip"><span>cm</span></td>
                                        <td style="text-align: center"><span>手臂:</span></td>
                                        <td ><span>左:</span><input type="text" v-model="girth.arm_left"><span>cm</span></td>
                                        <td ><span>右:</span><input type="text" v-model="girth.arm_right"><span>cm</span></td>
                                    </tr>
                                    <tr style="font-weight: bold">
                                        <td colspan="3">三 力量测试：</td>
                                        <td colspan="3">四 心肺测试：</td>
                                    </tr>
                                    <tr>
                                        <td><span>动作</span></td>
                                        <td><span>重量</span></td>
                                        <td><span>次数</span></td>
                                        <td><span>动作</span></td>
                                        <td><span>时间</span></td>
                                        <td><span>次数</span></td>
                                    </tr>
                                    <tr>
                                        <td><span>平板卧推/俯卧撑</span></td>
                                        <td><input type="text" v-model="strength.bench_press.weight"></td>
                                        <td><input type="text" v-model="strength.bench_press.number"></td>
                                        <td><span>开合跳</span></td>
                                        <td><input type="text" v-model="cardiopulmonary.open_close.time"></td>
                                        <td><input type="text" v-model="cardiopulmonary.open_close.number"></td>
                                    </tr>
                                    <tr>
                                        <td><span>硬拉/仰卧悬垂体</span></td>
                                        <td><input type="text" v-model="strength.hard_pull.weight"></td>
                                        <td><input type="text" v-model="strength.hard_pull.number"></td>
                                        <td><span>波比跳</span></td>
                                        <td><input type="text" v-model="cardiopulmonary.bobby_jump.time"></td>
                                        <td><input type="text" v-model="cardiopulmonary.bobby_jump.number"></td>
                                    </tr>
                                    <tr>
                                        <td><span>深蹲</span></td>
                                        <td><input type="text" v-model="strength.deep_squat.weight"></td>
                                        <td><input type="text" v-model="strength.deep_squat.number"></td>
                                        <td><span>跳绳（基础/高抬）</span></td>
                                        <td><input type="text" v-model="cardiopulmonary.rope_skipping.time"></td>
                                        <td><input type="text" v-model="cardiopulmonary.rope_skipping.number"></td>
                                    </tr>
                                    <tr style="font-weight: bold"><td colspan="6">五 格斗技巧：</td></tr>
                                    <tr>
                                        <td colspan="2"><span>动作</span></td>
                                        <td colspan="2"><span>时间</span></td>
                                        <td colspan="2"><span>次数</span></td>

                                    </tr>
                                    <tr v-for="(item,index) in fighting_skills" :key="index">
                                        <td colspan="2"><input type="text" v-model="fighting_skills[index].move"></td>
                                        <td colspan="2"><input type="text" v-model="fighting_skills[index].time"></td>
                                        <td colspan="2"><input type="text" v-model="fighting_skills[index].number"></td>
                                    </tr>
                                    <tr>
                                        <td>测试时间：</td>
                                        <td colspan="3">
                                            <div class="am-form-group tpl-form-border-form am-fl">
                                                <input type="text" name="fitness[data][test_time]"
                                                       class="am-form-field"
                                                       value="" required placeholder="请选择" data-am-datepicker>
                                            </div>
                                        </td>
                                        <td>教练员：</td>
                                        <td>
                                            <select name="fitness[coach_id]" data-am-selected="{searchBox: 1, btnSize: 'sm', placeholder:'请选择', maxHeight: 400}"
                                                    required>
                                                <option value=""></option>
                                                <?php if (isset($coachList) && !$coachList->isEmpty()):
                                                    foreach ($coachList as $item): ?>
                                                        <option value="<?= $item['coach_id'] ?>"><?= $item['real_name'] ?></option>
                                                    <?php endforeach; endif; ?>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>本次结果：</td>
                                        <td colspan="5"><input type="text" v-model="result"></td>
                                    </tr>
                                    <tr>
                                        <td>个人评语：</td>
                                        <td colspan="5"><input type="text" v-model="comments"></td>
                                    </tr>
                                    <tr ><td colspan="6" style="text-align: center">（希望教练针对哪方面加强和自己对本阶段的总结）</td></tr>
                                    </tbody>
                                </table>
                            </div>
                            <!-- 表单提交按钮 -->
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>

                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="assets/common/js/vue.min.js"></script>
<script src="assets/common/js/ddsort.js"></script>
<script src="assets/common/plugins/umeditor/umeditor.config.js?v=<?= $version ?>"></script>
<script src="assets/common/plugins/umeditor/umeditor.min.js"></script>
<script src="assets/store/js/goods.spec.js?v=<?= $version ?>"></script>
<script>

    $(function () {

        function Fitness(){
            this.initialize()
        }
        Fitness.prototype = {
            appVue:null,
            initialize:function () {
                this.appVue = new Vue({
                    el: '#my-form',
                    data: {
                        user:{name:'',sex:'',age:'',height:'',weight:''},
                        purpose:'',//目的
                        duration:{stage:'',joint:''}, //时长
                        girth:{chest:'',waistline:'',hip:'',arm_left:'',arm_right:''},
                        strength:{
                            bench_press:{weight:'',number:''},
                            hard_pull:{weight:'',number:''},
                            deep_squat:{weight:'',number:''},
                        },
                        cardiopulmonary:{
                            open_close:{time:'',number:''},
                            bobby_jump:{time:'',number:''},
                            rope_skipping:{time:'',number:''},
                        },
                        fighting_skills:[
                            {move:'',time:'',number:''},
                            {move:'',time:'',number:''},
                        ],
                        result:'',
                        comments:'',
                        // test_time:''
                    },
                    methods:{
                        getData: function () {
                            return this.$data;
                        },
                    },
                })
            }
        }
        window.Fitness = Fitness
        // 注册商品多规格组件
        var specMany = new Fitness({
            el: '#my-form'
        });

        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm({
            // 获取多规格sku数据
            buildData: function () {
                var specData = specMany.appVue.getData();
                console.log(specData)
                return {
                    fitness: {
                        data:specData
                    }
                };
            },
            // 自定义验证
            validation: function () {
                var test_md = $('input:radio[name="md"]:checked').val();
                var test_time = $('input[name="fitness[data][test_time]"]').val();
                var title = $('input[name="fitness[title]"]').val();
                var specData = specMany.appVue.getData();
                if (specData.user.name === '' || specData.user.name === undefined){
                    layer.msg('请输入会员姓名');
                    return false;
                }
                if (title === '' || title === undefined) {
                    layer.msg('请输入表头');
                    return false;
                }
                if (test_md === '' || test_md === undefined) {
                    layer.msg('请选择训练目的');
                    return false;
                }
                if (test_time === '' || test_time === undefined) {
                    layer.msg('请选择测试时间');
                    return false;
                }
                if (specData.result === '' || specData.result === undefined) {
                    layer.msg('请输入本次评估结果');
                    return false;
                }
                return true;
            }
        });
    });
</script>
